package xyz.lne.researchgroupmanage.mapper.neo4j;

import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.stereotype.Repository;
import xyz.lne.researchgroupmanage.entity.neo4j.KeywordNode;

@Repository
public interface KeywordNodeRepository extends Neo4jRepository<KeywordNode, Long> {

    @Query("MATCH (kw:keyword{keywordId:$keywordId}) RETURN kw")
    KeywordNode findKeywordNodeByKId(Integer keywordId);

    @Query("MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE n,r")
    void deleteAllNodeAndRelationShip();
}
